package com.lagou.homeWork3.hw4;

import java.util.List;

public class StudentAdd {

    public static void addStudent(int id, String name, int age,List<Student> listStudents) {
        Student st = new Student(id, name, age);
        boolean flag = listStudents.contains(st);
        if (flag) {
            System.out.println("学号已经存在，添加失败!");

        } else {
            listStudents.add(st);
            System.out.println("添加成功!");
        }
    }
}
